This Quarto file documents the R worflow used to analyse the data in the paper ‘Effects of past and present habitat on the gut microbiota of a wild rodent’ written by Tiffany Scholier, Anton Lavrinienko, Eva R. Kallio, Phillip C. Watts & Tapio Mappes.
Legend
Throughout the code, the past habitat/site of origin is referred to as sitetr1 and the present habitat/site of transfer is referred to as sitetr2. Urban and rural sites are abbreviated by urb and cont (control), respectively. For example, the term urbcont refers to animals that were translocated from urban forest sites to rural forest sites. Overall, time point 1 refers to pre-transfer samples and time point 3 refers to post-transfer samples.
Analysis of Variance Table
Response: Distances
Df Sum Sq Mean Sq F value Pr(>F)
Groups 1 0.000690 0.0006905 0.1827 0.6726
Residuals 26 0.098249 0.0037788
Analysis of Variance Table
Response: Distances
Df Sum Sq Mean Sq F value Pr(>F)
Groups 1 0.000321 0.00032109 0.1865 0.6694
Residuals 26 0.044763 0.00172167
Permutation test for adonis under reduced model
Marginal effects of terms
Permutation: free
Number of permutations: 9999
adonis2(formula = wunifrac_dist.mom.time1 ~ sitetr1, data = metadata.psrt.time1, permutations = 9999, by = "margin")
Df SumOfSqs R2 F Pr(>F)
sitetr1 1 0.0002923 0.05254 1.4418 0.1791
Residual 26 0.0052707 0.94746
Total 27 0.0055629 1.00000
Analysis of Variance Table
Response: Distances
Df Sum Sq Mean Sq F value Pr(>F)
Groups 1 0.00001552 1.5517e-05 0.5003 0.4857
Residuals 26 0.00080641 3.1016e-05
Analysis of Variance Table
Response: Distances
Df Sum Sq Mean Sq F value Pr(>F)
Groups 1 0.010445 0.0104451 11.043 0.002651 **
Residuals 26 0.024592 0.0009458
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Show the code
boxplot(mod.mom.1.uu) #Higher variance in rural samples in comparison to urban samples
Recreate Table S2
Differences in alpha diversity between the pre-transfer gut microbiota of urban and rural bank voles
Show the code
#Test normalityshapiro.test(metadata.mom.time1$observed_features) #p-value = 0.264 = NORMAL DISTRIBUTIONshapiro.test(metadata.mom.time1$shannon_entropy) #p-value = 0.458 = NORMAL DISTRIBUTIONshapiro.test(metadata.mom.time1$faith_pd) #p-value = 0.6019 = NORMAL DISTRIBUTION#Normality = OK -> use linear models
Call:
lm(formula = faith_pd ~ sitetr1, data = metadata.mom.time1)
Residuals:
Min 1Q Median 3Q Max
-5.2540 -2.4222 0.4342 1.6654 5.9643
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 18.2507 0.8940 20.416 <2e-16 ***
sitetr1urban -0.1107 1.1826 -0.094 0.926
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 3.097 on 26 degrees of freedom
Multiple R-squared: 0.0003366, Adjusted R-squared: -0.03811
F-statistic: 0.008756 on 1 and 26 DF, p-value: 0.9262
Recreate Table S3
Temporal change in the alpha diversity of the gut microbiota of bank voles within each experimental group
Show the code
#Order the dataframes (same individuals should we listed together)metadata.mom.1.3<- metadata.mom %>%arrange(ind)
Show the code
# Test normality of the differencesshapiro.test(diff.13$asv_1_to_3) #p-value = 0.8119 = NORMAL DISTRIBUTIONshapiro.test(diff.13$shannon_1_to_3) #p-value = 0.9922 = NORMAL DISTRIBUTIONshapiro.test(diff.13$faith_1_to_3) #p-value = 0.5452 = NORMAL DISTRIBUTION
ASV richness
Show the code
#Normality = OK -> Use t-testsstat.test.13<-metadata.mom.1.3%>%group_by(treatment) %>%t_test(observed_features ~ time, paired=TRUE,alternative ="two.sided") %>%adjust_pvalue(method ="fdr") %>%add_significance("p.adj") stat.test.13
bp.pd <-ggpaired(metadata.mom.1.3, x ="time", y ="faith_pd", order =c("1", "3"), color="treatment",line.color ="gray", line.size =0.4,id ="ind",ylab ="Faith's PD", xlab ="")+scale_x_discrete(labels=c("1"="Pre-transfer", "3"="Post-transfer"))+facet_wrap(~ treatment, nrow=2,ncol=2)bp.pd
Recreate Table S4
Pairwise differences in alpha diversity (temporal alpha diversity change) between the gut microbiota of bank voles belonging to different experimental groups
ASV richness
Show the code
#Normality = OK (see 'Recreate Table S2')-> Use linear modelsmodel.13.asv <-lm(asv_1_to_3 ~ sitetr1*sitetr2, data = diff.13)summary(model.13.asv)
Call:
lm(formula = asv_1_to_3 ~ sitetr1 * sitetr2, data = diff.13)
Residuals:
Min 1Q Median 3Q Max
-368.43 -63.29 -11.10 89.34 262.22
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -28.143 57.451 -0.490 0.629
sitetr1urban 106.571 81.248 1.312 0.202
sitetr2urban -7.257 89.002 -0.082 0.936
sitetr1urban:sitetr2urban -31.394 117.427 -0.267 0.791
Residual standard error: 152 on 24 degrees of freedom
Multiple R-squared: 0.09611, Adjusted R-squared: -0.01687
F-statistic: 0.8507 on 3 and 24 DF, p-value: 0.4799
Show the code
model.13.asv.2<-lm(asv_1_to_3 ~ sitetr1+sitetr2, data = diff.13)summary(model.13.asv.2)
Call:
lm(formula = asv_1_to_3 ~ sitetr1 + sitetr2, data = diff.13)
Residuals:
Min 1Q Median 3Q Max
-360.91 -66.30 -10.27 94.17 267.09
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -20.63 49.17 -0.420 0.678
sitetr1urban 91.54 57.56 1.590 0.124
sitetr2urban -25.29 56.97 -0.444 0.661
Residual standard error: 149.2 on 25 degrees of freedom
Multiple R-squared: 0.09342, Adjusted R-squared: 0.02089
F-statistic: 1.288 on 2 and 25 DF, p-value: 0.2935
Show the code
model.13.asv.3<-lm(asv_1_to_3 ~ sitetr1, data = diff.13)summary(model.13.asv.3)
Call:
lm(formula = asv_1_to_3 ~ sitetr1, data = diff.13)
Residuals:
Min 1Q Median 3Q Max
-346.69 -62.08 -4.19 86.92 281.31
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -31.17 42.39 -0.735 0.469
sitetr1urban 87.85 56.07 1.567 0.129
Residual standard error: 146.8 on 26 degrees of freedom
Multiple R-squared: 0.08627, Adjusted R-squared: 0.05113
F-statistic: 2.455 on 1 and 26 DF, p-value: 0.1292
Shannon diversity
Show the code
model.13.shannon <-lm(shannon_1_to_3 ~ sitetr1*sitetr2, data = diff.13)summary(model.13.shannon)
Call:
lm(formula = shannon_1_to_3 ~ sitetr1 * sitetr2, data = diff.13)
Residuals:
Min 1Q Median 3Q Max
-2.8977 -0.6074 -0.1111 0.9135 2.3347
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.3849 0.5336 -0.721 0.478
sitetr1urban 1.1707 0.7546 1.551 0.134
sitetr2urban -0.4004 0.8267 -0.484 0.633
sitetr1urban:sitetr2urban -0.8348 1.0907 -0.765 0.451
Residual standard error: 1.412 on 24 degrees of freedom
Multiple R-squared: 0.1629, Adjusted R-squared: 0.05824
F-statistic: 1.557 on 3 and 24 DF, p-value: 0.2258
Show the code
model.13.shannon.2<-lm(shannon_1_to_3 ~ sitetr1+sitetr2, data = diff.13)summary(model.13.shannon.2)
Call:
lm(formula = shannon_1_to_3 ~ sitetr1 + sitetr2, data = diff.13)
Residuals:
Min 1Q Median 3Q Max
-3.05313 -0.72255 -0.08885 0.90926 2.23625
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.1851 0.4615 -0.401 0.692
sitetr1urban 0.7710 0.5403 1.427 0.166
sitetr2urban -0.8799 0.5348 -1.645 0.112
Residual standard error: 1.4 on 25 degrees of freedom
Multiple R-squared: 0.1424, Adjusted R-squared: 0.07384
F-statistic: 2.076 on 2 and 25 DF, p-value: 0.1465
Faith’s phylogenetic diversity
Show the code
model.13.faith <-lm(faith_1_to_3 ~ sitetr1*sitetr2, data = diff.13)summary(model.13.faith)
Call:
lm(formula = faith_1_to_3 ~ sitetr1 * sitetr2, data = diff.13)
Residuals:
Min 1Q Median 3Q Max
-10.8544 -2.7661 0.3567 3.9439 8.2502
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.007656 1.961622 0.004 0.997
sitetr1urban 2.200009 2.774152 0.793 0.436
sitetr2urban -1.753781 3.038931 -0.577 0.569
sitetr1urban:sitetr2urban 0.475530 4.009479 0.119 0.907
Residual standard error: 5.19 on 24 degrees of freedom
Multiple R-squared: 0.07039, Adjusted R-squared: -0.04581
F-statistic: 0.6057 on 3 and 24 DF, p-value: 0.6177
Show the code
model.13.faith.2<-lm(faith_1_to_3 ~ sitetr1+sitetr2, data = diff.13)summary(model.13.faith.2)
Call:
lm(formula = faith_1_to_3 ~ sitetr1 + sitetr2, data = diff.13)
Residuals:
Min 1Q Median 3Q Max
-10.7659 -2.7206 0.2429 3.9894 8.1364
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.1062 1.6767 -0.063 0.950
sitetr1urban 2.4277 1.9630 1.237 0.228
sitetr2urban -1.4806 1.9429 -0.762 0.453
Residual standard error: 5.087 on 25 degrees of freedom
Multiple R-squared: 0.06984, Adjusted R-squared: -0.00457
F-statistic: 0.9386 on 2 and 25 DF, p-value: 0.4045
All metrics in terms of change
Show the code
model.13.asv.change <-lm(asv_1_to_3 ~ change, data = diff.13)summary(model.13.asv.change)
Call:
lm(formula = asv_1_to_3 ~ change, data = diff.13)
Residuals:
Min 1Q Median 3Q Max
-321.00 -77.06 15.00 64.69 307.00
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 31.00 44.23 0.701 0.490
changesame -20.94 58.52 -0.358 0.723
Residual standard error: 153.2 on 26 degrees of freedom
Multiple R-squared: 0.0049, Adjusted R-squared: -0.03337
F-statistic: 0.128 on 1 and 26 DF, p-value: 0.7234
Show the code
model.13.shannon.change <-lm(shannon_1_to_3 ~ change, data = diff.13)summary(model.13.shannon.change)
Call:
lm(formula = shannon_1_to_3 ~ change, data = diff.13)
Residuals:
Min 1Q Median 3Q Max
-2.9259 -0.7607 -0.2163 1.0557 2.6910
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.1312 0.4201 0.312 0.757
changesame -0.5524 0.5557 -0.994 0.329
Residual standard error: 1.455 on 26 degrees of freedom
Multiple R-squared: 0.03661, Adjusted R-squared: -0.0004424
F-statistic: 0.9881 on 1 and 26 DF, p-value: 0.3294
Show the code
model.13.faith.change <-lm(faith_1_to_3 ~ change, data = diff.13)summary(model.13.faith.change)
Call:
lm(formula = faith_1_to_3 ~ change, data = diff.13)
Residuals:
Min 1Q Median 3Q Max
-10.600 -2.834 0.551 3.047 9.898
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.56025 1.49293 0.375 0.711
changesame -0.03411 1.97496 -0.017 0.986
Residual standard error: 5.172 on 26 degrees of freedom
Multiple R-squared: 1.147e-05, Adjusted R-squared: -0.03845
F-statistic: 0.0002983 on 1 and 26 DF, p-value: 0.9864
Recreate Table S5
Differences in alpha diversity between the post-transfer gut microbiota of bank voles belonging to different experimental groups
Show the code
#Test Normalityshapiro.test(metadata.mom.time3$observed_features) #p-value = 0.0513 = NORMAL DISTRIBUTIONshapiro.test(metadata.mom.time3$shannon_entropy) #p-value = 0.7244 = NORMAL DISTRIBUTIONshapiro.test(metadata.mom.time3$faith_pd) #p-value = 0.9103 = NORMAL DISTRIBUTION#Normality = OK -> use linear models
Call:
lm(formula = faith_pd ~ sitetr1, data = metadata.mom.time3)
Residuals:
Min 1Q Median 3Q Max
-6.8655 -2.4988 0.3974 2.3988 5.7020
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 17.5276 0.9466 18.516 <2e-16 ***
sitetr1urban 2.1011 1.2522 1.678 0.105
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 3.279 on 26 degrees of freedom
Multiple R-squared: 0.0977, Adjusted R-squared: 0.06299
F-statistic: 2.815 on 1 and 26 DF, p-value: 0.1054
Recreate Table S6
Pairwise distances in beta diversity (temporal beta diversity change) between the gut microbiota of bank voles belonging to different experimental groups
Show the code
#Test normalityshapiro.test(dist.13$bray_1_to_3) #p-value = 0.4519 = NORMAL DISTRIBUTIONshapiro.test(dist.13$jacc_1_to_3) #p-value = 0.4296 = NORMAL DISTRIBUTIONshapiro.test(dist.13$wunifrac_1_to_3) #p-value = 0.01187 = NOT NORMAL#This needs to be adjusted with a log transformationdist.13$log_wunifrac_1_to_3 <-log(dist.13$wunifrac_1_to_3)shapiro.test(dist.13$log_wunifrac_1_to_3) #p-value = 0.3476 = NORMAL DISTRIBUTIONshapiro.test(dist.13$unwunifrac_1_to_3) #0.07002 = NORMAL DISTRIBUTION
Bray-Curtis metric
Show the code
lm.aov.13.bray <-lm(bray_1_to_3 ~ sitetr1*sitetr2, data = dist.13)summary(lm.aov.13.bray)
Call:
lm(formula = bray_1_to_3 ~ sitetr1 * sitetr2, data = dist.13)
Residuals:
Min 1Q Median 3Q Max
-0.162441 -0.069969 0.003738 0.058870 0.220408
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.61869 0.04236 14.605 1.94e-13 ***
sitetr1urban 0.15324 0.05991 2.558 0.0173 *
sitetr2urban 0.12538 0.06563 1.911 0.0681 .
sitetr1urban:sitetr2urban -0.17219 0.08658 -1.989 0.0583 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.1121 on 24 degrees of freedom
Multiple R-squared: 0.2352, Adjusted R-squared: 0.1396
F-statistic: 2.46 on 3 and 24 DF, p-value: 0.08717
Show the code
lm.aov.13.bray.2<-lm(bray_1_to_3 ~ sitetr1+sitetr2, data = dist.13)summary(lm.aov.13.bray.2)
Call:
lm(formula = bray_1_to_3 ~ sitetr1 + sitetr2, data = dist.13)
Residuals:
Min 1Q Median 3Q Max
-0.20201 -0.06944 0.01582 0.08990 0.17919
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.65991 0.03907 16.891 3.48e-15 ***
sitetr1urban 0.07081 0.04574 1.548 0.134
sitetr2urban 0.02646 0.04527 0.585 0.564
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.1185 on 25 degrees of freedom
Multiple R-squared: 0.1092, Adjusted R-squared: 0.0379
F-statistic: 1.532 on 2 and 25 DF, p-value: 0.2358
Show the code
lm.aov.13.bray.3<-lm(bray_1_to_3 ~ sitetr1, data = dist.13)summary(lm.aov.13.bray.3) #p-value = 0.107
Call:
lm(formula = bray_1_to_3 ~ sitetr1, data = dist.13)
Residuals:
Min 1Q Median 3Q Max
-0.213041 -0.059301 0.002861 0.093445 0.168166
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.67093 0.03378 19.864 <2e-16 ***
sitetr1urban 0.07467 0.04468 1.671 0.107
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.117 on 26 degrees of freedom
Multiple R-squared: 0.09699, Adjusted R-squared: 0.06226
F-statistic: 2.793 on 1 and 26 DF, p-value: 0.1067
Jaccard metric
Show the code
lm.aov.13.jacc <-lm(jacc_1_to_3 ~ sitetr1*sitetr2, data = dist.13)summary(lm.aov.13.jacc)
Call:
lm(formula = jacc_1_to_3 ~ sitetr1 * sitetr2, data = dist.13)
Residuals:
Min 1Q Median 3Q Max
-0.064476 -0.034023 -0.004301 0.030581 0.107604
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.74599 0.01773 42.065 <2e-16 ***
sitetr1urban 0.01821 0.02508 0.726 0.475
sitetr2urban 0.02802 0.02747 1.020 0.318
sitetr1urban:sitetr2urban -0.04311 0.03625 -1.189 0.246
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.04692 on 24 degrees of freedom
Multiple R-squared: 0.05732, Adjusted R-squared: -0.06051
F-statistic: 0.4865 on 3 and 24 DF, p-value: 0.6949
Show the code
lm.aov.13.jacc.2<-lm(jacc_1_to_3 ~ sitetr1+sitetr2, data = dist.13)summary(lm.aov.13.jacc.2)
Call:
lm(formula = jacc_1_to_3 ~ sitetr1 + sitetr2, data = dist.13)
Residuals:
Min 1Q Median 3Q Max
-0.07250 -0.02955 -0.01030 0.03583 0.09958
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.756305 0.015594 48.499 <2e-16 ***
sitetr1urban -0.002425 0.018257 -0.133 0.895
sitetr2urban 0.003259 0.018070 0.180 0.858
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.04731 on 25 degrees of freedom
Multiple R-squared: 0.001764, Adjusted R-squared: -0.07809
F-statistic: 0.02209 on 2 and 25 DF, p-value: 0.9782
Weighted Unifrac metric
Show the code
lm.aov.13.wunifrac <-lm(log_wunifrac_1_to_3 ~ sitetr1*sitetr2, data = dist.13)summary(lm.aov.13.wunifrac)
Call:
lm(formula = log_wunifrac_1_to_3 ~ sitetr1 * sitetr2, data = dist.13)
Residuals:
Min 1Q Median 3Q Max
-0.46018 -0.25177 -0.02192 0.25763 0.66431
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -1.84601 0.12408 -14.878 1.3e-13 ***
sitetr1urban 0.46568 0.17548 2.654 0.0139 *
sitetr2urban 0.04571 0.19222 0.238 0.8141
sitetr1urban:sitetr2urban -0.24713 0.25361 -0.974 0.3396
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.3283 on 24 degrees of freedom
Multiple R-squared: 0.264, Adjusted R-squared: 0.172
F-statistic: 2.87 on 3 and 24 DF, p-value: 0.05747
Show the code
lm.aov.13.wunifrac.2<-lm(log_wunifrac_1_to_3 ~ sitetr1+sitetr2, data = dist.13)summary(lm.aov.13.wunifrac.2)
Call:
lm(formula = log_wunifrac_1_to_3 ~ sitetr1 + sitetr2, data = dist.13)
Residuals:
Min 1Q Median 3Q Max
-0.50619 -0.18498 -0.06516 0.29733 0.61830
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -1.78685 0.10811 -16.529 5.74e-15 ***
sitetr1urban 0.34737 0.12656 2.745 0.0111 *
sitetr2urban -0.09626 0.12527 -0.768 0.4494
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.328 on 25 degrees of freedom
Multiple R-squared: 0.2349, Adjusted R-squared: 0.1737
F-statistic: 3.837 on 2 and 25 DF, p-value: 0.03521
Show the code
lm.aov.13.wunifrac.3<-lm(log_wunifrac_1_to_3 ~ sitetr1, data = dist.13)summary(lm.aov.13.wunifrac.3) #p-value (origin) = 0.0125
Call:
lm(formula = log_wunifrac_1_to_3 ~ sitetr1, data = dist.13)
Residuals:
Min 1Q Median 3Q Max
-0.54830 -0.23072 -0.06091 0.25695 0.57619
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -1.82696 0.09392 -19.452 <2e-16 ***
sitetr1urban 0.33333 0.12425 2.683 0.0125 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.3254 on 26 degrees of freedom
Multiple R-squared: 0.2168, Adjusted R-squared: 0.1867
F-statistic: 7.197 on 1 and 26 DF, p-value: 0.01252
Unweighted Unifrac metric
Show the code
lm.aov.13.unwunifrac <-lm(unwunifrac_1_to_3 ~ sitetr1*sitetr2, data = dist.13)summary(lm.aov.13.unwunifrac)
Call:
lm(formula = unwunifrac_1_to_3 ~ sitetr1 * sitetr2, data = dist.13)
Residuals:
Min 1Q Median 3Q Max
-0.07833 -0.03882 -0.01391 0.04370 0.11902
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.416245 0.022107 18.828 7.02e-16 ***
sitetr1urban 0.027492 0.031264 0.879 0.388
sitetr2urban 0.017493 0.034248 0.511 0.614
sitetr1urban:sitetr2urban -0.003048 0.045186 -0.067 0.947
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.05849 on 24 degrees of freedom
Multiple R-squared: 0.0808, Adjusted R-squared: -0.0341
F-statistic: 0.7032 on 3 and 24 DF, p-value: 0.5594
Show the code
lm.aov.13.unwunifrac.2<-lm(unwunifrac_1_to_3 ~ sitetr1+sitetr2, data = dist.13)summary(lm.aov.13.unwunifrac.2) #p-value > 0.05
Call:
lm(formula = unwunifrac_1_to_3 ~ sitetr1 + sitetr2, data = dist.13)
Residuals:
Min 1Q Median 3Q Max
-0.07730 -0.03938 -0.01456 0.04333 0.12004
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.41697 0.01889 22.070 <2e-16 ***
sitetr1urban 0.02603 0.02212 1.177 0.250
sitetr2urban 0.01574 0.02189 0.719 0.479
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.05731 on 25 degrees of freedom
Multiple R-squared: 0.08062, Adjusted R-squared: 0.007072
F-statistic: 1.096 on 2 and 25 DF, p-value: 0.3497
All metrics in terms of change
Show the code
#All metrics in terms of changelm.aov.13.bray.change <-lm(bray_1_to_3 ~ change, data = dist.13)summary(lm.aov.13.bray.change) #p-value = 0.0757
Call:
lm(formula = bray_1_to_3 ~ change, data = dist.13)
Residuals:
Min 1Q Median 3Q Max
-0.220667 -0.065626 -0.007383 0.055750 0.212674
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.76032 0.03341 22.75 <2e-16 ***
changesame -0.08176 0.04420 -1.85 0.0757 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.1157 on 26 degrees of freedom
Multiple R-squared: 0.1163, Adjusted R-squared: 0.08231
F-statistic: 3.422 on 1 and 26 DF, p-value: 0.07574
Show the code
lm.aov.13.jacc.change <-lm(jacc_1_to_3 ~ change, data = dist.13)summary(lm.aov.13.jacc.change) #p-value = 0.245
Call:
lm(formula = jacc_1_to_3 ~ change, data = dist.13)
Residuals:
Min 1Q Median 3Q Max
-0.063108 -0.033264 -0.004496 0.027075 0.108972
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.76829 0.01305 58.86 <2e-16 ***
changesame -0.02054 0.01727 -1.19 0.245
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.04522 on 26 degrees of freedom
Multiple R-squared: 0.05163, Adjusted R-squared: 0.01515
F-statistic: 1.415 on 1 and 26 DF, p-value: 0.2449
Show the code
lm.aov.13.wu.change <-lm(log_wunifrac_1_to_3 ~ change, data = dist.13)summary(lm.aov.13.wu.change) #p-value = 0.311
Call:
lm(formula = log_wunifrac_1_to_3 ~ change, data = dist.13)
Residuals:
Min 1Q Median 3Q Max
-0.54166 -0.22631 -0.06207 0.20003 0.77992
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -1.5553 0.1040 -14.952 2.78e-14 ***
changesame -0.1420 0.1376 -1.032 0.311
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.3603 on 26 degrees of freedom
Multiple R-squared: 0.03937, Adjusted R-squared: 0.002423
F-statistic: 1.066 on 1 and 26 DF, p-value: 0.3115
Show the code
lm.aov.13.uu.change <-lm(unwunifrac_1_to_3 ~ change, data = dist.13)summary(lm.aov.13.uu.change) #p-value = 0.991
Call:
lm(formula = unwunifrac_1_to_3 ~ change, data = dist.13)
Residuals:
Min 1Q Median 3Q Max
-0.08416 -0.05045 -0.01211 0.03699 0.11565
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.4395709 0.0169202 25.979 <2e-16 ***
changesame 0.0002637 0.0223833 0.012 0.991
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.05861 on 26 degrees of freedom
Multiple R-squared: 5.34e-06, Adjusted R-squared: -0.03846
F-statistic: 0.0001388 on 1 and 26 DF, p-value: 0.9907
Show the code
plot(bray_1_to_3~treatment, data=dist.13)
Show the code
plot(jacc_1_to_3~treatment, data=dist.13)
Show the code
plot(log_wunifrac_1_to_3~treatment, data=dist.13)
Show the code
plot(unwunifrac_1_to_3~treatment, data=dist.13)
Recreate Table S7
Differences in beta diversity between the post-transfer gut microbiota of bank voles belonging to different experimental groups
Permutation test for adonis under reduced model
Marginal effects of terms
Permutation: free
Number of permutations: 9999
adonis2(formula = bray_dist.mom.time3 ~ sitetr1 * sitetr2, data = metadata.psrt.time3, permutations = 9999, by = "margin")
Df SumOfSqs R2 F Pr(>F)
sitetr1:sitetr2 1 0.2730 0.03753 1.0668 0.3515
Residual 24 6.1425 0.84443
Total 27 7.2741 1.00000
Analysis of Variance Table
Response: Distances
Df Sum Sq Mean Sq F value Pr(>F)
Groups 1 0.001958 0.0019577 0.3982 0.5335
Residuals 26 0.127820 0.0049162
Permutation test for adonis under reduced model
Marginal effects of terms
Permutation: free
Number of permutations: 9999
adonis2(formula = jacc_dist.mom.time3 ~ sitetr1 * sitetr2, data = metadata.psrt.time3, permutations = 9999, by = "margin")
Df SumOfSqs R2 F Pr(>F)
sitetr1:sitetr2 1 0.3649 0.03825 1.0664 0.3011
Residual 24 8.2126 0.86087
Total 27 9.5398 1.00000
Analysis of Variance Table
Response: Distances
Df Sum Sq Mean Sq F value Pr(>F)
Groups 1 0.000914 0.00091446 0.3879 0.5388
Residuals 26 0.061298 0.00235761
Permutation test for adonis under reduced model
Marginal effects of terms
Permutation: free
Number of permutations: 9999
adonis2(formula = wunifrac_dist.mom.time3 ~ sitetr1 * sitetr2, data = metadata.psrt.time3, permutations = 9999, by = "margin")
Df SumOfSqs R2 F Pr(>F)
sitetr1:sitetr2 1 0.0000751 0.01778 0.4977 0.8134
Residual 24 0.0036202 0.85733
Total 27 0.0042226 1.00000
Permutation test for adonis under reduced model
Marginal effects of terms
Permutation: free
Number of permutations: 9999
adonis2(formula = wunifrac_dist.mom.time3 ~ sitetr1, data = metadata.psrt.time3, permutations = 9999, by = "margin")
Df SumOfSqs R2 F Pr(>F)
sitetr1 1 0.0002738 0.06485 1.8029 0.122
Residual 26 0.0039488 0.93515
Total 27 0.0042226 1.00000
Permutation test for adonis under reduced model
Marginal effects of terms
Permutation: free
Number of permutations: 9999
adonis2(formula = wunifrac_dist.mom.time3 ~ sitetr2, data = metadata.psrt.time3, permutations = 9999, by = "margin")
Df SumOfSqs R2 F Pr(>F)
sitetr2 1 0.0002335 0.0553 1.5219 0.1722
Residual 26 0.0039891 0.9447
Total 27 0.0042226 1.0000
Analysis of Variance Table
Response: Distances
Df Sum Sq Mean Sq F value Pr(>F)
Groups 1 0.00000361 3.612e-06 0.1047 0.7488
Residuals 26 0.00089675 3.449e-05
Permutation test for adonis under reduced model
Marginal effects of terms
Permutation: free
Number of permutations: 9999
adonis2(formula = uunifrac_dist.mom.time3 ~ sitetr1 * sitetr2, data = metadata.psrt.time3, permutations = 9999, by = "margin")
Df SumOfSqs R2 F Pr(>F)
sitetr1:sitetr2 1 0.2452 0.03910 1.0803 0.2642
Residual 24 5.4462 0.86869
Total 27 6.2694 1.00000
Analysis of Variance Table
Response: Distances
Df Sum Sq Mean Sq F value Pr(>F)
Groups 1 0.0000587 5.875e-05 0.0524 0.8207
Residuals 26 0.0291454 1.121e-03
Analysis of Variance Table
Response: Distances
Df Sum Sq Mean Sq F value Pr(>F)
Groups 1 0.000084 0.00008399 0.0619 0.8055
Residuals 26 0.035292 0.00135739
Recreate Table S8
Differences in alpha diversity and beta diversity between the post-transfer gut microbiota of offspring belonging to different experimental groups
The offspring data consists of dependent data points since multiple siblings are included into the same dataset. For analyses concerning alpha diversity, we can simply include genetic cluster (i.e., siblings belong to the same group) as a random effect in lmer models. For beta diversity analyses, there are no straightforward methods to include random effects within adonis2 models. To deal with the dependence in our data, we coded a loop (n iterations = 1000) where 1) one sibling per genetic cluster gets randomly selected (33 individuals are left), 2) the adonis2 output gets computed based upon this reduced dataset and 3) the average value for all output generated over 1000 runs gets calculated.
The same output is generated by the loop when 1000 or 10 iterations are used, so the workflow in this quarto document contains the lowest number of iterations for convenience and efficiency.
Permutation test for adonis under reduced model
Marginal effects of terms
Permutation: free
Number of permutations: 9999
adonis2(formula = uu_dist.pup ~ geneticcluster, data = metadata.psrt.pup.gc, permutations = 9999, by = "margin")
Df SumOfSqs R2 F Pr(>F)
geneticcluster 32 11.2718 0.64608 2.2248 1e-04 ***
Residual 39 6.1747 0.35392
Total 71 17.4465 1.00000
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Recreate Figure S1
Individual taxa bar plots displaying the bacterial families in the post-transfer gut microbiota in adult and juvenile bank voles arranged according to experimental group